package com.ly.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.ly.dao.RolesDao;
import com.ly.entity.Roles;
import com.ly.rep.PageRequest;
import com.ly.service.RolesService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;

@Service
public class RolesServiceImpl implements RolesService {
    @Resource
    private RolesDao rolesDao;
    @Override
    public PageInfo<Roles> queryByPage(PageRequest<Roles> pageRequest) {
        PageHelper.startPage(pageRequest.getPageNum(),pageRequest.getPageSize());
        List<Roles> rolesList = rolesDao.selectAll(pageRequest.getQ());
        PageInfo<Roles> rolesPageInfo = new PageInfo<>(rolesList);
        return rolesPageInfo;
    }
}
